﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Realtors.Web.UI.Models
{
    public class ContactUsViewModel
    {
        [DataType(DataType.Text)]
        [StringLength(50)]
        [Required(ErrorMessageResourceName = "NameIsRequired",ErrorMessageResourceType = typeof(ErrorMessagesResource))]
        [Display(Name ="Name",ResourceType = typeof(Resources))]
        public string Name { get; set; }
        
        [DataType(DataType.EmailAddress)]
        [StringLength(100)]
        [Required(ErrorMessageResourceName = "EmailAddressRequired",ErrorMessageResourceType=typeof(ErrorMessagesResource))]
        [Display(Name = "EmailAddress", ResourceType = typeof(Resources))]
        [RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(ErrorMessagesResource))]
        public string EmailAddress { get; set; }

        [DataType(DataType.PhoneNumber)]
        [StringLength(20)]
        [Required(ErrorMessageResourceName = "PhoneIsRequired",ErrorMessageResourceType = typeof(ErrorMessagesResource))]
        [Display(Name = "PhoneNumber", ResourceType = typeof(Resources))]
        [RegularExpression(@"^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$",ErrorMessageResourceName = "InvalidPhone",ErrorMessageResourceType = typeof(ErrorMessagesResource))]
        public string PhoneNumber { get; set; }

        [DataType(DataType.Text)]
        [StringLength(1000)]
        [Required(ErrorMessageResourceName = "MessageIsRequired", ErrorMessageResourceType = typeof(ErrorMessagesResource))]
        [Display(Name = "Message", ResourceType = typeof(Resources))]
        public string Message { get; set; }

        [DataType(DataType.DateTime)]
        public DateTime DateSent { get; set; }
    }
}